import request from './request.js'
import configs from './configs'

const baseURL = configs.API_BASE_URL

// wx登录
export const wxlogin = (data) => {
  return request({
		baseURL,
		method: 'POST',
		url: `/wx/user/${data.appid}/login`,
		data
	})
}

// 订单管理---预约
export const predetermine = (data) => {
  return request({
		baseURL,
		method: 'POST',
		url: `/member/order/predetermine`,
		data
	})
}

// 订单管理---取消订单付款
export const payFail = (data) => {
	return request({
		  baseURL,
		  method: 'POST',
		  url: `/member/order/pay/fail?sn=${data.sn}`,
		  data
	  })
  }

// 订单管理---取消订单检验
export const validateOrder = (data) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/member/order/cancel/validate?sn=${data.sn}`
	})
}
// 订单管理---取消订单
export const cancelOrder = (data) => {
  return request({
		baseURL,
		method: 'POST',
		url: `/member/order/cancel?sn=${data.sn}`,
		data
	})
}
// 订单管理---我的订单
export const myOrders = (data) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/member/orders/${data.orderStatus}?pageNum=${data.pageNum}&pageSize=${data.pageSize}`
	})
}
// 订单管理---订单详情
export const orderDetail = (data) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/member/order/detail?sn=${data.sn}`
	})
}
// 会员车辆管理---设置默认车辆
export const showable = (data) => {
  return request({
		baseURL,
		method: 'POST',
		url: `/member/cart/showable?id=${data.id}`,
		data,
		header:{}
	})
}
// 会员车辆管理---新增车辆
export const addCart = (data) => {
  return request({
		baseURL,
		method: 'POST',
		url: `/member/cart/add`,
		data
	})
}
// 会员车辆管理---编辑车辆
export const editCart = (data) => {
  return request({
		baseURL,
		method: 'POST',
		url: `/member/cart/edit`,
		data
	})
}
// 会员车辆管理---洗车方案
export const washMenu = (data) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/member/cart/wash/menu`,
		data
	})
}
// 会员车辆管理---洗车方案-详情
export const menuInfo = (data) => {
	return request({
		  baseURL,
		  method: 'GET',
		  url: `/member/cart/menu`,
		  data
	  })
  }
// 会员车辆管理---逆向获取位置
export const regeo = (data) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/member/regeo`,
		data
	})
}
// 会员车辆管理---车辆类型
export const cartTypes = (data) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/member/cart/types`,
		data
	})
}
// 会员车辆管理---我的车辆
export const myCart = (data) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/member/cart/mine`,
		data
	})
}
// 会员车辆管理---删除车辆
export const carDel = (data) => {
  return request({
		baseURL,
		method: 'DELETE',
		url: `/member/cart/del?id=${data.id}`,
		data
	})
}
// 会员车辆管理---附近驻点
export const nearStore = (data) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/member/near/store`,
		data
	})
}
// 会员车辆管理---首页
export const memberIndex = () => {
  return request({
		baseURL,
		method: 'GET',
		url: `/member/index`
	})
}

// 会员车辆管理---我的
export const myInfo = () => {
  return request({
		baseURL,
		method: 'GET',
		url: `/member/mine`
	})
}

// 会员车辆管理---修改个人中心
export const updateUserInfo = () => {
  return request({
		baseURL,
		method: 'POST',
		url: `/member/modify`
	})
}


// 文件-上传
export const upload = (data) => {
  return request({
		baseURL,
		method: 'POST',
		header:{
			'content-type':'multipart/form-data',
		},
		url: `/file/upload`,
		data
	})
}